<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:insert="~{common/comm_blocks :: comm_header(title=~{::title}, links=~{::link}, scripts=~{::head_scripts/script})}">
    <title>测试Thymeleaf</title>
</head>

<body>
<h3 th:text="${name}"></h3>
<h3 th:text="${name2 ?: '李四啊'}"></h3>
<h3 th:text="${name} != null ? ${name} : '是张三'"></h3>
<p style="color:red" th:text="'Hello, ' + ${welcomewords}">即将被替换的文本</p>
<p style="color:red" th:utext="'Hello, ' + ${welcomewords2}">即将被替换的文本</p>
<!-- 不能使用@{url} 否则会链接到http://127.0.0.1:8887/yumeng2/demo/thymeleaf/url -->
<a th:href="${url}">查看链接</a>
<li th:each="ts : ${tests}">
    <span th:text="${#dates.format(ts.dateVal, 'yyyy-MM-dd HH:mm:ss')}"></span>
</li>
<p th:object="${test}">
    <span th:text="*{testId}"></span>
    <span th:text="*{strVal}"></span>
    <span th:text="*{intVal}"></span>
    <span th:text="*{douVal}"></span>
    <span th:text="*{#dates.format(dateVal, 'yyyy-MM-dd HH:mm:ss')}"></span>
    <span th:text="*{#temporals.format(localDateTimeVal, 'yyyy-MM-dd HH:mm:ss')}"></span>
</p>

<hr/>
<p th:text="${#strings.listIsEmpty(nameList)}"></p>
<p th:text="${#arrays.toStringArray(nameList)}"></p>

<p th:text="${#strings.trim(' ab c ')}"></p>

<!--<p th:text="'ContextPath() : ' + ${#request.getContextPath()}"></p>
<p th:text="'contextPath : ' + ${#servletContext.contextPath}"></p>-->

<script th:inline="javascript">
    /*<![CDATA[*/
    //var max = /*[[${maxSumOfDateInYear}]]*/ 20;
    //alert(max);
    /*]]>*/
    //alert('[[${jsstr}]]');
    //alert([[${jsstr}]]);
/*    var jsstr33 = /!*[[${jsstr33}]]*!/ '这里是后端给的jsstr数据';
    alert(jsstr33);*/
    //alert('[[${jsstr2}]]');
</script>
</body>
</html>